package com.zzyl.nursing.controller.member;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.zzyl.common.constant.HttpStatus;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.common.utils.UserThreadLocal;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "订单管理")
@Slf4j
public class MemberOrdersController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询护理项目")
    public TableDataInfo<NursingProject> page(Integer pageNum, Integer pageSize,
                                              @RequestParam(defaultValue = "1") Integer status, String name) {
        log.warn("当前登录人ID：{}", UserThreadLocal.getUserId());
        Page pageResult = nursingProjectService.pageByNameAndStatus(pageNum, pageSize, status, name);
        return getDataTable(pageResult);
    }

    @GetMapping("{id}")
    @ApiOperation("获取护理项目详细信息")
    public R<NursingProject> getInfo(@ApiParam(value = "护理项目ID",required = true) @PathVariable Long id){
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }



}
